/*@description: nginx 封装了不同平台下的获取线程tid的接口 
 *
 *
 *
 */

/*
 * Copyright (C) Igor Sysoev
 * Copyright (C) Nginx, Inc.
 */


#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_thread_pool.h>


#if (NGX_LINUX)

/*
 * Linux thread id is a pid of thread created by clone(2),
 * glibc does not provide a wrapper for gettid().
 */

/*@brief: 获取线程的tid号
 *
 *
 */
ngx_tid_t ngx_thread_tid(void)
{
    return syscall(SYS_gettid);
}

#else

ngx_tid_t ngx_thread_tid(void)
{
    return (uint64_t) (uintptr_t) pthread_self();
}

#endif
